package net.wanho.client;

import net.wanho.config.MyLoadBalancerConfig;
import net.wanho.entity.User;
import net.wanho.vo.AjaxResult;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * Author：汤小洋
 * Date：2025-08-05 15:04
 * Description：<描述>
 */
// @FeignClient("user-provider")
// @FeignClient(value = "cloud-gateway", path = "/api/v2", fallback = UserClientFallback.class) // 指定请求前缀
@FeignClient(value = "cloud-gateway", path = "/api/v2") // 指定请求前缀
@LoadBalancerClients(defaultConfiguration = MyLoadBalancerConfig.class) // 指定负载均衡策略
public interface UserClient {

    @GetMapping("/users/test")
    public String test();

    @GetMapping("/users")
    AjaxResult findByUsername(@RequestParam("username") String username);

    @GetMapping("/users/{id}")
    AjaxResult findById(@PathVariable("id") Integer id);

    @PostMapping("/users/add")
    AjaxResult add(@RequestBody User user);
}
